<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {


    public function Index(){
        $lunbo = M('adv') ->where('status = 1')-> select();
        $this -> assign('lunbo',$lunbo);
        $xiamen = M('xiamen') -> find(1);
        $xiamen['history']=html_entity_decode( $xiamen['history']);
        $xiamen['introduction']=html_entity_decode( $xiamen['introduction']);
        $xiamen['culture']=html_entity_decode( $xiamen['culture']);
        $this -> assign('xiamen',$xiamen);
        $tuijian = M('tuijian')-> order('id desc')->limit(6)->select();
        $this -> assign('tuijian',$tuijian);
        $sights = M('sights')-> order('id desc')-> limit(6) ->select();
        $this -> assign('sights',$sights);
        $news = M('news')-> order('id desc')->limit(4)->select();
        foreach($news as $value){
           
            $value['text']=html_entity_decode($value['text']);
            
        }
        $this -> assign('news',$news);
        $this -> display();
    }
    // public function checkout(){
    //     session(null);
    //     $this ->success('退出成功');
    // }
    // public function ajaxdianzan(){
    //     $get = I('get.id');
    //     $model = M('fengmian');
    //     $data = $model->find($get);
    //     ++$data['hot'];
    //     $model -> save($data);
    //     echo json_encode($data);
    // }
    // public function sousuo(){
    //     if(IS_POST){
    //     $post =I('post.vname');
    //     $model =M('fengmian');
    //     $data['vname'] =array('like',"%".$post."%");
    //     $bangdan=$model ->where($data) ->select();
    //     $this ->assign('bangdan',$bangdan);      
    //     $model = M('lunbo');
    //     $model1 = M('fengmian');
    //     $lunbo = $model ->where('status = 1')-> select();
    //     $jingxuan5 = $model1 ->where('type=1 and status=1')-> order('hot desc')->limit(8,3)->select();
    //     $new = $model1 ->where('type=5 and status=1')-> order('hot desc')->limit(3)->select();
    //     $this -> assign('lunbo',$lunbo);
    //     $this -> assign('jingxuan5',$jingxuan5);
    //     $this -> assign('new',$new);
    //     $this->display();
    //     }
    // }
}